#include <string.h>
#include "container.h"
#include "zone.h"


/* *********************************** */
/*			linked list class		   */
/* *********************************** */

llist init_llist(void)
  { lnode* head = (lnode*)ALLOCATE(sizeof(struct lnode));
    memset(head, 0, sizeof(struct lnode));
	return head;
  }
void insert_head(llist head, void* data)
  { lnode* x = (lnode*)ALLOCATE(sizeof(struct lnode));
	x->data = data;
	x->next = head->next; head->next = x;
  }
void free_nodes(llist head)
  { while (-1 != delete_head(head));
	DEALLOCATE(head);
  }
int delete_head(llist head)
  { lnode* p = head->next;
	if (NULL == p) return -1;
	head->next = p->next;
	DEALLOCATE(p);
	return 0;
  }

